package com.gzhryc.shared_device.oem.code.profit.dao.db;

import com.gzhryc.jdbc.annotaion.*;
import com.gzhryc.jdbc.enums.DateBranchTableType;
import com.gzhryc.shared_device.oem.code.member.dao.enums.MemberBusinessOrderEnum;
import com.gzhryc.shared_device.oem.code.user.dao.db.User;

import java.io.Serializable;
import java.util.Date;

/**
 * 业务订单权限用户
 * @version 2023-03-15
 */
@DateBranchTable(type = DateBranchTableType.year)
@Table(name="business_order_user")
public class BusinessOrderUser implements Serializable {

    private static final long serialVersionUID = 1L;

	@PrimaryKey
    @Column(name = "trade_no",notNull = true,note = "用户ID")
    protected String tradeNo;

    @PrimaryKey
    @Column(name="user_id",notNull = true,note = "用户ID")
    protected Long userId;

    @Column(name = "device_fun_code", notNull = true, note = "设备功能Code")
    protected String deviceFunCode;

    @Column(name = "business_type", notNull = true, note = "业务类型")
    protected String businessType;

    @Column(name="role_names",length = 128,notNull = true,note = "角色")
    protected String roleNames;

    @Column(name="place_id",note = "网点ID")
    protected Long placeId;

    @Column(name="place_name",note = "网点名称")
    protected String placeName;

    @Column(name = "place_user_id",notNull = true,note = "网点用户ID")
    protected Long placeUserId;

    @Column(note = "省")
    protected String province;

    @Column(note = "城市")
    protected String city;

    @Column(name = "city_area",note = "城区")
    protected String cityArea;

    @Column(name = "area_code", length = 128, note = "地区ID，以逗号分隔")
    protected String areaCode;

    @Column(notNull = true, defVal = "1", note = "业务订单状态，用于查询")
    protected Integer state;

    @Column(name = "update_date", autoUpdateTime = true, note = "修改时间")
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    @Join(fromField = "user_id")
    protected User user;

    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getDeviceFunCode() {
        return deviceFunCode;
    }

    public void setDeviceFunCode(String deviceFunCode) {
        this.deviceFunCode = deviceFunCode;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public String getRoleNames() {
        return roleNames;
    }

    public void setRoleNames(String roleNames) {
        this.roleNames = roleNames;
    }

    public Long getPlaceId() {
        return placeId;
    }

    public void setPlaceId(Long placeId) {
        this.placeId = placeId;
    }

    public String getPlaceName() {
        return placeName;
    }

    public void setPlaceName(String placeName) {
        this.placeName = placeName;
    }

    public Long getPlaceUserId() {
        return placeUserId;
    }

    public void setPlaceUserId(Long placeUserId) {
        this.placeUserId = placeUserId;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCityArea() {
        return cityArea;
    }

    public void setCityArea(String cityArea) {
        this.cityArea = cityArea;
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getStateName(){
        return MemberBusinessOrderEnum.State.note(this.state);
    }
}
